package com.dsbj.it.DingTalkBotStarter.service.impl;

import com.dsbj.it.DingTalkBotStarter.common.enums.FieldTypeEnum;
import com.dsbj.it.DingTalkBotStarter.dao.entity.DemandDO;
import com.dsbj.it.DingTalkBotStarter.dao.entity.DetailDO;
import com.dsbj.it.DingTalkBotStarter.dao.mapper.DemandSaveMapper;
import com.dsbj.it.DingTalkBotStarter.service.DemandService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import static com.dsbj.it.DingTalkBotStarter.common.enums.FieldTypeEnum.DOUBLE;

@Slf4j
@Service
@RequiredArgsConstructor
public class DemandServiceImpl extends
        AbstractExcelBatchSaveServiceImpl<DemandSaveMapper, DemandDO>
        implements DemandService {

    public void saveDemand() {
        // 调用公共方法
        saveFromExcel();
    }

    @Override
    protected String getExcelFilePath() {
        return "D:\\0project\\DingTalkBot\\demo\\file\\demand.xlsx";
    }

    @Override
    protected DemandDO createDO() {
        return DemandDO.builder().build();
    }

    @Override
    protected FieldTypeEnum getDetailType() {
        return DOUBLE;
    }

    @Override
    protected void setCommonProperties(DemandDO doEntity, DetailDO detailDO) {
        doEntity.setDetailDO(detailDO);
        doEntity.setSimId(191566089237309850L);
    }
}
